package demo.bytebuddy;

import net.bytebuddy.ByteBuddy;
import net.bytebuddy.NamingStrategy;
import net.bytebuddy.description.type.TypeDescription;
import net.bytebuddy.dynamic.DynamicType;

/**
 * description: <br>
 * createTime: 2019/2/199:16 <br>
 *
 * @author zzh
 */
public class ByteBuddyDemo {

    public static void main(String[] args) {
        DynamicType.Unloaded<?> dynamicType = new ByteBuddy()
                .with(new NamingStrategy.AbstractBase() {
                    @Override
                    public String subclass(TypeDescription.Generic superClass) {
                        System.out.println(superClass.getTypeName());
                        return "i.love.ByteBuddy." + superClass.getTypeName();
                    }


                    @Override
                    protected String name(TypeDescription superClass) {
                        return null;
                    }
                })
                .subclass(Object.class)
                .make();
        Class<? extends DynamicType.Unloaded> aClass = dynamicType.getClass();
        System.out.println(aClass.getName());

        System.out.println(aClass.getSuperclass());
    }
}
